import request from './request'
let userid=''
if(localStorage.getItem('userInfo')==null){
    userid=''
}else{
    userid=JSON.parse(localStorage.getItem('userInfo')).userId
}

// 查询博客
export function queryblog(id){
    return request({
        url:'/api/blog/'+id,
        method:'GET',
        // headers:{
        //     'api-type': 1
        // },
        // data:params
    })
}

// 添加博客
export function addblog(params) {
    return request({
        url: '/api/blog',
        method: 'POST',
        headers: {
            'api-type': 1
        },
        data: params
    })
}
// 编辑博客
export function editblog(params) {
    return request({
        url: '/api/blog',
        method: 'PUT',
        headers: {
            'api-type': 1,
            'userid':userid
        },
        data: params
    })
}